Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

  • Analyze the issue: R8 task command line exceeds 32,000 character limit
  • Review existing code (D8.cs, R8.cs, JavaSourceUtils.cs for reference pattern)
  • Research R8/D8 response file support (@argfile syntax)
  • Implement response file support in D8 task
    • Create method to generate response file with jar inputs and lib references
    • Modify GetCommandLineBuilder to use response file for library arguments
    • Clean up response file after task execution
  • Build verification - project builds successfully
  • Add tests for response file functionality
    • Test that response file contains lib and input jars
    • Test that paths with spaces are handled correctly (no quoting needed)
  • Run code review - addressed feedback
  • Fix CI failure: Removed quoting from response file paths (R8/D8 treats each line as a complete argument)
  • Use IsNullOrEmpty() extension method instead of is { Length: > 0 } pattern in D8.cs
  • Add R8-specific arguments (--pg-conf, --main-dex-list, etc.) to response file in R8.cs
  • Move ALL D8/R8 switches to response file (only JVM args remain on command line: -Xmx, -classpath, main class)
Original prompt

This section details on the original issue you should resolve

<issue_title>Build error - The command line for R8 Tasks is too long. Command lines longer than 32000 chars are likely to fail.</issue_title>
<issue_description>### Android framework version

net10.0-android

Affected platform version

net10.0 android 36.1 VS2026 Insiders [11408.92]

Description

I was attempting to upgrade NuGets. In particular, Xamarin.AndroidX.AppCompat from 1.7.1.1 to 1.7.1.2, Xamarin.AndroidX.Navigation.UI 2.9 .6 to 2.9.6.1 and Xamarin.AndroidX.NavigationUI 2.9.6 to 2.9.6.1. NavigationUI should have dragged in Xamarin.Google.AndroidMaterial 1.13.1 instead of 1.13.0, which I was hoping would eliminate the warnings Google Play Console emits for every production build re Edge-To-Edge using deprecated APIs, etc. - issue #10304. The actual message is The command line for R8 Task is too long. Command lines longer than 32,000 characters are likely to fail. Try reducing the length of the command line by breaking down the call to R8 into multiple calls with fewer parameters per call.

msbuild.zip

Steps to Reproduce

N/A

Did you find any workaround?

No response

Relevant log output

```</issue_description>

<agent_instructions>Use a "response file" for passing all arguments to `r8.jar`, this should apply for both the `<R8/>` and `<D8/>` MSBuild tasks.

See this PR on a past attempt at implementing this: https://github.com/dotnet/android/pull/9546</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 23, 2026 20:08
… length limits

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
@jonathanpeppers

This comment was marked as outdated.

…te argument

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

@copilot I don't think these changes work:

       Using "D8" task from assembly "C:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\36.1.99-ci.copilot-fix-r8-command-line-erro...

Fixed in c387499. The issue was that I was adding quotes around paths with spaces in the response file, but R8/D8's response file parser treats each line as a complete argument - no quoting is needed. Removed the quoting logic from WriteArg() to match how JavaSourceUtils.cs handles response files.

Copilot AI requested a review from jonathanpeppers January 27, 2026 17:28
@jonathanpeppers jonathanpeppers changed the title [WIP] Fix build error due to long R8 command line [xabt] use a response file when calling java r8.jar Jan 28, 2026
@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 28, 2026 19:53
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already surprisingly decent, but I reran some test lanes to get it completely green.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot you completely missed adding the same treatment to the <R8/> task that extends D8!

This task should be using the same response file for all arguments -- otherwise, it will just hit the limit eventually, too!

…s to response file

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot you completely missed adding the same treatment to the <R8/> task that extends D8!

Fixed in 75f4235. Modified R8.cs to override CreateResponseFile() instead of GetCommandLineBuilder(), so all R8-specific arguments (--pg-conf, --main-dex-list, --main-dex-rules, --no-tree-shaking, --no-minification, etc.) are now also written to the response file.

…nd line

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI requested a review from jonathanpeppers January 28, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build error - The command line for R8 Tasks is too long. Command lines longer than 32000 chars are likely to fail.

3 participants